export interface IListItem {
    "id": number,
    "name": string,
    "age": number,
    "gender": number,
    "salary": number,
    "create_time": string,
    "depart_id": number
}

/* 这里不直接用上面的是因为列表可能显示的不全 */
interface IUserDetail {
    "id": number,
    "name": string,
    "password": string,
    "age": number,
    "gender": number,
    "salary": number,
    "create_time": string,
    "depart_id": number
}

export interface IState {
    userInfo: {
        list: Array<IListItem>,
        page_info: {
            current_page: number,
            page_size: number,
            total_count: number
        }
    },
    currentUserDetail: IUserDetail
}

export interface IUserDetailParam {
    id: number
}

interface IUserListParam {
    current_page: number,
    page_size: number
}

interface IAddUserParam {
    "name": string,
    "password": string,
    "age": number,
    "gender": number,
    "salary": number,
    "create_time": string,
    "depart_id": number
}

interface IDeleteUserParam {
    "id": number
}

interface IUpdateUserParam {
    "id": number,
    "name": string,
    "age": number,
    "gender": number,
    "salary": number,
    "create_time": string,
    "depart_id": number | string
}

export interface IActions {
    requestUserDetailAction: (params: IUserDetailParam) => void,
    requestUserListAction: (params: IUserListParam) => void,
    addUserAction: (params: IAddUserParam) => Promise<boolean>,
    deleteUserAction: (params: IDeleteUserParam) => Promise<boolean>,
    updateUserAction: (params: IUpdateUserParam) => Promise<boolean>,
}

export enum USER_URL_TYPE {
    USER_LIST = "user/list",
    USER_ADD = "user/add",
    USER_UPDATE = "user/update",
    USER_DELETE = "user/delete",
    USER_DETAIL = "user/detail",
}
